+2001-04-27 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
+
+ * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
+
+ * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
+ line/para separators
+ (gtk_entry_create_layout): set single paragraph mode on the layout
+
+ * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
+ spacing between the image and label; instead, inside a button box
+ the button will get extra space that will go there, but if people
+ configure button box for 0 chubbiness, then there's no spacing.
+
+ * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
+ and min/max size style properties, so people can tune their
+ chubbiness.
+
+ * tests/testgtk.c (make_toolbar): remove calls to removed toolbar
+ functions
+
+ * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
+ space_style, and button_relief into style properties, remove
+ functions for setting them
+
+ * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
+ it back down
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
+ types from gtk_widget_style_get
+
+ * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
+ with a style property.
+
+ * gdk/x11/gdkevents-x11.c: namespace the settings
+
+ * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
+
+ * gtk/gtksettings.c (gtk_settings_class_init): remove code with
+ side effects from inside g_assert(), so that G_DISABLE_ASSERT can
+ be used. Also, translate doc strings for settings. Also, namespace
+ the double-click-time property. Also, remove bell properties crap.
+
2001-04-27 Sven Neumann <sven@gimp.org>
* Makefile.am: before creating links, check if pkg-config files
+2001-04-27 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
+
+ * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
+
+ * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
+ line/para separators
+ (gtk_entry_create_layout): set single paragraph mode on the layout
+
+ * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
+ spacing between the image and label; instead, inside a button box
+ the button will get extra space that will go there, but if people
+ configure button box for 0 chubbiness, then there's no spacing.
+
+ * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
+ and min/max size style properties, so people can tune their
+ chubbiness.
+
+ * tests/testgtk.c (make_toolbar): remove calls to removed toolbar
+ functions
+
+ * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
+ space_style, and button_relief into style properties, remove
+ functions for setting them
+
+ * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
+ it back down
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
+ types from gtk_widget_style_get
+
+ * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
+ with a style property.
+
+ * gdk/x11/gdkevents-x11.c: namespace the settings
+
+ * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
+
+ * gtk/gtksettings.c (gtk_settings_class_init): remove code with
+ side effects from inside g_assert(), so that G_DISABLE_ASSERT can
+ be used. Also, translate doc strings for settings. Also, namespace
+ the double-click-time property. Also, remove bell properties crap.
+
2001-04-27 Sven Neumann <sven@gimp.org>
* Makefile.am: before creating links, check if pkg-config files
+2001-04-27 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
+
+ * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
+
+ * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
+ line/para separators
+ (gtk_entry_create_layout): set single paragraph mode on the layout
+
+ * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
+ spacing between the image and label; instead, inside a button box
+ the button will get extra space that will go there, but if people
+ configure button box for 0 chubbiness, then there's no spacing.
+
+ * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
+ and min/max size style properties, so people can tune their
+ chubbiness.
+
+ * tests/testgtk.c (make_toolbar): remove calls to removed toolbar
+ functions
+
+ * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
+ space_style, and button_relief into style properties, remove
+ functions for setting them
+
+ * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
+ it back down
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
+ types from gtk_widget_style_get
+
+ * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
+ with a style property.
+
+ * gdk/x11/gdkevents-x11.c: namespace the settings
+
+ * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
+
+ * gtk/gtksettings.c (gtk_settings_class_init): remove code with
+ side effects from inside g_assert(), so that G_DISABLE_ASSERT can
+ be used. Also, translate doc strings for settings. Also, namespace
+ the double-click-time property. Also, remove bell properties crap.
+
2001-04-27 Sven Neumann <sven@gimp.org>
* Makefile.am: before creating links, check if pkg-config files
+2001-04-27 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
+
+ * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
+
+ * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
+ line/para separators
+ (gtk_entry_create_layout): set single paragraph mode on the layout
+
+ * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
+ spacing between the image and label; instead, inside a button box
+ the button will get extra space that will go there, but if people
+ configure button box for 0 chubbiness, then there's no spacing.
+
+ * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
+ and min/max size style properties, so people can tune their
+ chubbiness.
+
+ * tests/testgtk.c (make_toolbar): remove calls to removed toolbar
+ functions
+
+ * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
+ space_style, and button_relief into style properties, remove
+ functions for setting them
+
+ * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
+ it back down
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
+ types from gtk_widget_style_get
+
+ * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
+ with a style property.
+
+ * gdk/x11/gdkevents-x11.c: namespace the settings
+
+ * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
+
+ * gtk/gtksettings.c (gtk_settings_class_init): remove code with
+ side effects from inside g_assert(), so that G_DISABLE_ASSERT can
+ be used. Also, translate doc strings for settings. Also, namespace
+ the double-click-time property. Also, remove bell properties crap.
+
2001-04-27 Sven Neumann <sven@gimp.org>
* Makefile.am: before creating links, check if pkg-config files
+2001-04-27 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
+
+ * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
+
+ * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
+ line/para separators
+ (gtk_entry_create_layout): set single paragraph mode on the layout
+
+ * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
+ spacing between the image and label; instead, inside a button box
+ the button will get extra space that will go there, but if people
+ configure button box for 0 chubbiness, then there's no spacing.
+
+ * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
+ and min/max size style properties, so people can tune their
+ chubbiness.
+
+ * tests/testgtk.c (make_toolbar): remove calls to removed toolbar
+ functions
+
+ * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
+ space_style, and button_relief into style properties, remove
+ functions for setting them
+
+ * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
+ it back down
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
+ types from gtk_widget_style_get
+
+ * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
+ with a style property.
+
+ * gdk/x11/gdkevents-x11.c: namespace the settings
+
+ * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
+
+ * gtk/gtksettings.c (gtk_settings_class_init): remove code with
+ side effects from inside g_assert(), so that G_DISABLE_ASSERT can
+ be used. Also, translate doc strings for settings. Also, namespace
+ the double-click-time property. Also, remove bell properties crap.
+
2001-04-27 Sven Neumann <sven@gimp.org>
* Makefile.am: before creating links, check if pkg-config files
+2001-04-27 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
+
+ * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
+
+ * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
+ line/para separators
+ (gtk_entry_create_layout): set single paragraph mode on the layout
+
+ * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
+ spacing between the image and label; instead, inside a button box
+ the button will get extra space that will go there, but if people
+ configure button box for 0 chubbiness, then there's no spacing.
+
+ * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
+ and min/max size style properties, so people can tune their
+ chubbiness.
+
+ * tests/testgtk.c (make_toolbar): remove calls to removed toolbar
+ functions
+
+ * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
+ space_style, and button_relief into style properties, remove
+ functions for setting them
+
+ * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
+ it back down
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
+ types from gtk_widget_style_get
+
+ * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
+ with a style property.
+
+ * gdk/x11/gdkevents-x11.c: namespace the settings
+
+ * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
+
+ * gtk/gtksettings.c (gtk_settings_class_init): remove code with
+ side effects from inside g_assert(), so that G_DISABLE_ASSERT can
+ be used. Also, translate doc strings for settings. Also, namespace
+ the double-click-time property. Also, remove bell properties crap.
+
2001-04-27 Sven Neumann <sven@gimp.org>
* Makefile.am: before creating links, check if pkg-config files
+2001-04-27 Havoc Pennington <hp@redhat.com>
+
+ * gtk/gtkcombo.c (gtk_combo_popup_button_press): fix warning
+
+ * gtk/gtkmessagedialog.c (gtk_message_dialog_init): make messages selectable
+
+ * gtk/gtkentry.c (gtk_entry_real_insert_text): don't strip
+ line/para separators
+ (gtk_entry_create_layout): set single paragraph mode on the layout
+
+ * gtk/gtkbutton.c (gtk_button_new_from_stock): don't put much
+ spacing between the image and label; instead, inside a button box
+ the button will get extra space that will go there, but if people
+ configure button box for 0 chubbiness, then there's no spacing.
+
+ * gtk/gtkbbox.c (gtk_button_box_class_init): Make child ipadding
+ and min/max size style properties, so people can tune their
+ chubbiness.
+
+ * tests/testgtk.c (make_toolbar): remove calls to removed toolbar
+ functions
+
+ * gtk/gtktoolbar.c (gtk_toolbar_class_init): Make space_size,
+ space_style, and button_relief into style properties, remove
+ functions for setting them
+
+ * gtk/gtkmenu.c (gtk_menu_key_press): handle menu bar accel to pop
+ it back down
+
+ * gtk/gtkoptionmenu.c (gtk_option_menu_get_props): free boxed
+ types from gtk_widget_style_get
+
+ * gtk/gtkmenubar.c (gtk_menu_bar_set_shadow_type): Remove, replace
+ with a style property.
+
+ * gdk/x11/gdkevents-x11.c: namespace the settings
+
+ * gtk/gtkmenubar.c: Add F10 accelerator to move between menubars.
+
+ * gtk/gtksettings.c (gtk_settings_class_init): remove code with
+ side effects from inside g_assert(), so that G_DISABLE_ASSERT can
+ be used. Also, translate doc strings for settings. Also, namespace
+ the double-click-time property. Also, remove bell properties crap.
+
2001-04-27 Sven Neumann <sven@gimp.org>
* Makefile.am: before creating links, check if pkg-config files
@position: the position in the item list where the @child is added.
-<!-- ##### FUNCTION gtk_menu_bar_set_shadow_type ##### -->
-<para>
-Sets the shadow type to use on the GtkMenuBar. The shadow types to use are:
-GTK_SHADOW_NONE, GTK_SHADOW_IN, GTK_SHADOW_OUT, GTK_SHADOW_ETCHED_IN, and GTK_SHADOW_ETCHED_OUT
-</para>
-
-@menu_bar: a #GtkMenuBar
-@type: the GtkShadowtype
-
-
-<!-- ##### ARG GtkMenuBar:shadow ##### -->
-<para>
-Used by #GtkMenuBar to determine the shadow type.
-</para>
-
#GtkRcStyle structures to form a #GtkStyle.
</para>
+@parent_instance:
@name:
@bg_pixmap_name:
@font_desc:
@style: the new style for @toolbar.
-<!-- ##### FUNCTION gtk_toolbar_set_space_size ##### -->
-<para>
-should be used to set the number of pixels each item of space takes up in a toolbar.
-</para>
-
-@toolbar: a #GtkToolbar.
-@space_size: the new number of pixels that spaces should consume.
-
-
-<!-- ##### FUNCTION gtk_toolbar_set_space_style ##### -->
-<para>
-sets whether a 'space' in the toolbar appears as a line or just plain empty space.
-</para>
-
-@toolbar: a #GtkToolbar.
-@space_style: the new style for the toolbar's spaces.
-
-
<!-- ##### FUNCTION gtk_toolbar_set_tooltips ##### -->
<para>
sets if the tooltips of a toolbar should be active or not.
@enable: set to 0 to disable the tooltips, or 1 to enable them.
-<!-- ##### FUNCTION gtk_toolbar_set_button_relief ##### -->
-<para>
-
-</para>
-
-@toolbar:
-@relief:
-
-
-<!-- ##### FUNCTION gtk_toolbar_get_button_relief ##### -->
-<para>
-
-</para>
-
-@toolbar:
-@Returns:
-
-
<!-- ##### FUNCTION gtk_toolbar_insert_stock ##### -->
<para>
</para>
-<!-- ##### ARG GtkToolbar:space-size ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GtkToolbar:space-style ##### -->
-<para>
-
-</para>
-
-<!-- ##### ARG GtkToolbar:relief ##### -->
-<para>
-
-</para>
-
const char *xsettings_name;
const char *gdk_name;
} settings_map[] = {
- { "Net/DoubleClickTime", "double-click-timeout" },
- { "Net/DragThreshold", "drag-threshold" }
+ { "Net/DoubleClickTime", "gtk-double-click-timeout" },
+ { "Net/DragThreshold", "gtk-drag-threshold" }
};
static void
*/
#include "gtkbbox.h"
+#include "gtkintl.h"
static void gtk_button_box_class_init (GtkButtonBoxClass *klass);
static void gtk_button_box_init (GtkButtonBox *box);
-
-static gint default_child_min_width = 85;
-static gint default_child_min_height = 27;
-static gint default_child_ipad_x = 7;
-static gint default_child_ipad_y = 0;
-
+#define DEFAULT_CHILD_MIN_WIDTH 85
+#define DEFAULT_CHILD_MIN_HEIGHT 27
+#define DEFAULT_CHILD_IPAD_X 7
+#define DEFAULT_CHILD_IPAD_Y 0
GtkType
gtk_button_box_get_type (void)
/* FIXME we need to override the "spacing" property on GtkBox once
* libgobject allows that.
*/
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("child_min_width",
+ _("Minimum child width"),
+ _("Minimum width of buttons inside the box"),
+ 0,
+ G_MAXINT,
+ DEFAULT_CHILD_MIN_WIDTH,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("child_min_height",
+ _("Minimum child height"),
+ _("Minimum height of buttons inside the box"),
+ 0,
+ G_MAXINT,
+ DEFAULT_CHILD_MIN_HEIGHT,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("child_internal_pad_x",
+ _("Child internal width padding"),
+ _("Amount to increase child's size on either side"),
+ 0,
+ G_MAXINT,
+ DEFAULT_CHILD_IPAD_X,
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("child_internal_pad_y",
+ _("Child internal height padding"),
+ _("Amount to increase child's size on the top and bottom"),
+ 0,
+ G_MAXINT,
+ DEFAULT_CHILD_IPAD_Y,
+ G_PARAM_READABLE));
}
static void
bbox = GTK_BUTTON_BOX (widget);
- width_default = default_child_min_width;
- height_default = default_child_min_height;
- ipad_x_default = default_child_ipad_x;
- ipad_y_default = default_child_ipad_y;
+ gtk_widget_style_get (widget,
+ "child_min_width",
+ &width_default,
+ "child_min_height",
+ &height_default,
+ "child_internal_pad_x",
+ &ipad_x_default,
+ "child_internal_pad_y",
+ &ipad_y_default, NULL);
child_min_width = bbox->child_min_width != GTK_BUTTONBOX_DEFAULT
? bbox->child_min_width : width_default;
gtk_label_set_mnemonic_widget (GTK_LABEL (label), button);
image = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
- hbox = gtk_hbox_new (FALSE, 0);
+ hbox = gtk_hbox_new (FALSE, 1);
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 2);
- gtk_box_pack_end (GTK_BOX (hbox), label, TRUE, TRUE, 2);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+ gtk_box_pack_end (GTK_BOX (hbox), label, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (button), hbox);
gtk_widget_show_all (hbox);
gtk_widget_grab_focus (combo->entry);
if (event->button != 1)
- return;
+ return FALSE;
combo->current_button = event->button;
}
}
-static char *
-strstr_len (const char *haystack,
- int haystack_len,
- const char *needle)
-{
- int i;
-
- g_return_val_if_fail (haystack != NULL, NULL);
- g_return_val_if_fail (needle != NULL, NULL);
-
- if (haystack_len < 0)
- return strstr (haystack, needle);
- else
- {
- const char *p = haystack;
- int needle_len = strlen (needle);
- const char *end = haystack + haystack_len - needle_len;
-
- if (needle_len == 0)
- return (char *)haystack;
-
- while (*p && p <= end)
- {
- for (i = 0; i < needle_len; i++)
- if (p[i] != needle[i])
- goto next;
-
- return (char *)p;
-
- next:
- p++;
- }
- }
-
- return NULL;
-}
-
/* Default signal handlers
*/
static void
{
gint index;
gint n_chars;
- gchar line_separator[7];
- gint len;
- gchar *p;
if (new_text_length < 0)
new_text_length = strlen (new_text);
- /* We don't want to allow inserting paragraph delimeters
- */
- pango_find_paragraph_boundary (new_text, new_text_length, &new_text_length, NULL);
-
- /* Or line separators - this is really painful
- */
- len = g_unichar_to_utf8 (0x2028, line_separator); /* 0x2028 == LS */
- line_separator[len] = '\0';
-
- p = strstr_len (new_text, new_text_length, line_separator);
- if (p)
- new_text_length = p - new_text;
-
n_chars = g_utf8_strlen (new_text, new_text_length);
if (entry->text_max_length > 0 && n_chars + entry->text_length > entry->text_max_length)
{
gint preedit_length = 0;
PangoAttrList *preedit_attrs = NULL;
+ pango_layout_set_single_paragraph_mode (layout, TRUE);
+
if (include_preedit)
{
gtk_im_context_get_preedit_string (entry->im_context,
#include "gtkwindow.h"
#include "gtkhbox.h"
#include "gtkvscrollbar.h"
+#include "gtksettings.h"
#define MENU_ITEM_CLASS(w) GTK_MENU_ITEM_GET_CLASS (w)
GdkEventKey *event)
{
GtkMenuShell *menu_shell;
+ GtkMenu *menu;
gboolean delete = FALSE;
-
+ gchar *accel = NULL;
+
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
menu_shell = GTK_MENU_SHELL (widget);
-
- gtk_menu_stop_navigating_submenu (GTK_MENU (widget));
+ menu = GTK_MENU (widget);
+
+ gtk_menu_stop_navigating_submenu (menu);
if (GTK_WIDGET_CLASS (parent_class)->key_press_event (widget, event))
return TRUE;
+
+ g_object_get (G_OBJECT (gtk_settings_get_global ()),
+ "gtk-menu-bar-accel",
+ &accel,
+ NULL);
+ if (accel)
+ {
+ guint keyval = 0;
+ GdkModifierType mods = 0;
+ gboolean handled = FALSE;
+
+ gtk_accelerator_parse (accel, &keyval, &mods);
+
+ if (keyval == 0)
+ g_warning ("Failed to parse menu bar accelerator '%s'\n", accel);
+
+ /* FIXME this is wrong, needs to be in the global accel resolution
+ * thing, to properly consider i18n etc., but that probably requires
+ * AccelGroup changes etc.
+ */
+ if (event->keyval == keyval &&
+ (mods & event->state) == mods)
+ {
+ gtk_signal_emit_by_name (GTK_OBJECT (menu), "cancel");
+ }
+
+ g_free (accel);
+
+ if (handled)
+ return TRUE;
+ }
+
switch (event->keyval)
{
case GDK_Delete:
#include "gtkmain.h"
#include "gtkmenubar.h"
#include "gtkmenuitem.h"
+#include "gtksettings.h"
+#include "gtkintl.h"
+#include "gtkwindow.h"
+#include "gtksignal.h"
enum {
ARG_0,
static void gtk_menu_bar_class_init (GtkMenuBarClass *klass);
-static void gtk_menu_bar_init (GtkMenuBar *menu_bar);
-static void gtk_menu_bar_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
-static void gtk_menu_bar_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id);
static void gtk_menu_bar_size_request (GtkWidget *widget,
GtkRequisition *requisition);
static void gtk_menu_bar_size_allocate (GtkWidget *widget,
GdkRectangle *area);
static gint gtk_menu_bar_expose (GtkWidget *widget,
GdkEventExpose *event);
-
+static void gtk_menu_bar_hierarchy_changed (GtkWidget *widget);
+static GtkShadowType get_shadow_type (GtkMenuBar *menubar);
static GtkMenuShellClass *parent_class = NULL;
sizeof (GtkMenuBar),
sizeof (GtkMenuBarClass),
(GtkClassInitFunc) gtk_menu_bar_class_init,
- (GtkObjectInitFunc) gtk_menu_bar_init,
+ (GtkObjectInitFunc) NULL,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
widget_class = (GtkWidgetClass*) class;
menu_shell_class = (GtkMenuShellClass*) class;
- gtk_object_add_arg_type ("GtkMenuBar::shadow", GTK_TYPE_SHADOW_TYPE, GTK_ARG_READWRITE, ARG_SHADOW);
-
- object_class->set_arg = gtk_menu_bar_set_arg;
- object_class->get_arg = gtk_menu_bar_get_arg;
-
widget_class->size_request = gtk_menu_bar_size_request;
widget_class->size_allocate = gtk_menu_bar_size_allocate;
widget_class->expose_event = gtk_menu_bar_expose;
-
+ widget_class->hierarchy_changed = gtk_menu_bar_hierarchy_changed;
+
menu_shell_class->submenu_placement = GTK_TOP_BOTTOM;
binding_set = gtk_binding_set_by_class (class);
"move_current", 1,
GTK_TYPE_MENU_DIRECTION_TYPE,
GTK_MENU_DIR_CHILD);
-}
-
-static void
-gtk_menu_bar_init (GtkMenuBar *menu_bar)
-{
- menu_bar->shadow_type = GTK_SHADOW_OUT;
-}
-
-static void
-gtk_menu_bar_set_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- GtkMenuBar *menu_bar;
- menu_bar = GTK_MENU_BAR (object);
-
- switch (arg_id)
- {
- case ARG_SHADOW:
- gtk_menu_bar_set_shadow_type (menu_bar, GTK_VALUE_ENUM (*arg));
- break;
- default:
- break;
- }
-}
-
-static void
-gtk_menu_bar_get_arg (GtkObject *object,
- GtkArg *arg,
- guint arg_id)
-{
- GtkMenuBar *menu_bar;
-
- menu_bar = GTK_MENU_BAR (object);
-
- switch (arg_id)
- {
- case ARG_SHADOW:
- GTK_VALUE_ENUM (*arg) = menu_bar->shadow_type;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
+ gtk_settings_install_property (gtk_settings_get_global (),
+ g_param_spec_string ("gtk-menu-bar-accel",
+ _("Menu bar accelerator"),
+ _("Keybinding to activate the menu bar"),
+ "F10",
+ G_PARAM_READWRITE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_enum ("shadow_type",
+ _("Shadow type"),
+ _("Style of bevel around the menubar"),
+ GTK_TYPE_SHADOW_TYPE,
+ GTK_SHADOW_OUT,
+ G_PARAM_READABLE));
}
GtkWidget*
}
}
-void
-gtk_menu_bar_set_shadow_type (GtkMenuBar *menu_bar,
- GtkShadowType type)
-{
- g_return_if_fail (menu_bar != NULL);
- g_return_if_fail (GTK_IS_MENU_BAR (menu_bar));
-
- if ((GtkShadowType) menu_bar->shadow_type != type)
- {
- menu_bar->shadow_type = type;
-
- if (GTK_WIDGET_DRAWABLE (menu_bar))
- {
- gtk_widget_queue_clear (GTK_WIDGET (menu_bar));
- }
- gtk_widget_queue_resize (GTK_WIDGET (menu_bar));
- }
-}
-
static void
gtk_menu_bar_paint (GtkWidget *widget, GdkRectangle *area)
{
gtk_paint_box (widget->style,
widget->window,
GTK_STATE_NORMAL,
- GTK_MENU_BAR (widget)->shadow_type,
+ get_shadow_type (GTK_MENU_BAR (widget)),
area, widget, "menubar",
0, 0,
-1,-1);
return FALSE;
}
+
+static gboolean
+window_key_press_handler (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data)
+{
+ gchar *accel = NULL;
+ gboolean retval = FALSE;
+
+ g_object_get (G_OBJECT (gtk_settings_get_global ()),
+ "gtk-menu-bar-accel",
+ &accel,
+ NULL);
+
+ if (accel)
+ {
+ guint keyval = 0;
+ GdkModifierType mods = 0;
+
+ gtk_accelerator_parse (accel, &keyval, &mods);
+
+ if (keyval == 0)
+ g_warning ("Failed to parse menu bar accelerator '%s'\n", accel);
+
+ /* FIXME this is wrong, needs to be in the global accel resolution
+ * thing, to properly consider i18n etc., but that probably requires
+ * AccelGroup changes etc.
+ */
+ if (event->keyval == keyval &&
+ (mods & event->state) == mods)
+ {
+ GtkMenuBar *menubar;
+ GtkMenuShell *menushell;
+
+ menubar = GTK_MENU_BAR (data);
+ menushell = GTK_MENU_SHELL (menubar);
+
+ if (menushell->children)
+ {
+ gtk_signal_emit_by_name (GTK_OBJECT (menushell->children->data),
+ "activate_item");
+
+ retval = TRUE;
+ }
+ }
+
+ g_free (accel);
+ }
+
+ return retval;
+}
+
+static void
+add_to_window (GtkWindow *window,
+ GtkMenuBar *menubar)
+{
+ GtkMenuBar *old_menubar;
+
+ old_menubar = g_object_get_data (G_OBJECT (window),
+ "gtk-menu-bar");
+
+ if (old_menubar)
+ return; /* ignore this case; app programmer on crack, but
+ * shouldn't spew stuff, just don't support the accel
+ * for menubar #2
+ */
+
+ g_object_set_data (G_OBJECT (window),
+ "gtk-menu-bar",
+ menubar);
+
+ g_signal_connect_data (G_OBJECT (window),
+ "key_press_event",
+ G_CALLBACK (window_key_press_handler),
+ menubar,
+ NULL, FALSE, FALSE);
+
+ menubar->toplevel = GTK_WIDGET (window);
+}
+
+/* Hack-around */
+#define g_signal_handlers_disconnect_by_func(obj, func, data) g_signal_handlers_disconnect_matched (obj, G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA, 0, 0, NULL, func, data)
+
+static void
+remove_from_window (GtkWindow *window,
+ GtkMenuBar *menubar)
+{
+ g_return_if_fail (menubar->toplevel == GTK_WIDGET (window));
+
+ g_signal_handlers_disconnect_by_func (G_OBJECT (window),
+ G_CALLBACK (window_key_press_handler),
+ menubar);
+
+ /* dnotify zeroes menubar->toplevel */
+ g_object_set_data (G_OBJECT (window),
+ "gtk-menu-bar",
+ NULL);
+
+ menubar->toplevel = NULL;
+}
+
+static void
+gtk_menu_bar_hierarchy_changed (GtkWidget *widget)
+{
+ GtkWidget *toplevel;
+ GtkMenuBar *menubar;
+
+ menubar = GTK_MENU_BAR (widget);
+
+ toplevel = gtk_widget_get_toplevel (widget);
+
+ if (menubar->toplevel &&
+ toplevel != menubar->toplevel)
+ {
+ remove_from_window (GTK_WINDOW (menubar->toplevel),
+ menubar);
+ }
+
+ if (toplevel &&
+ GTK_IS_WINDOW (toplevel))
+ {
+ add_to_window (GTK_WINDOW (toplevel),
+ menubar);
+ }
+}
+
+static GtkShadowType
+get_shadow_type (GtkMenuBar *menubar)
+{
+ GtkShadowType shadow_type = GTK_SHADOW_OUT;
+
+ gtk_widget_style_get (GTK_WIDGET (menubar),
+ "shadow_type", &shadow_type,
+ NULL);
+
+
+ return shadow_type;
+}
{
GtkMenuShell menu_shell;
- GtkShadowType shadow_type;
+ GtkWidget *toplevel;
};
struct _GtkMenuBarClass
void gtk_menu_bar_insert (GtkMenuBar *menu_bar,
GtkWidget *child,
gint position);
-void gtk_menu_bar_set_shadow_type (GtkMenuBar *menu_bar,
- GtkShadowType type);
-
#ifdef __cplusplus
}
dialog->image = gtk_image_new_from_stock (NULL, GTK_ICON_SIZE_DIALOG);
gtk_label_set_line_wrap (GTK_LABEL (dialog->label), TRUE);
-
+ gtk_label_set_selectable (GTK_LABEL (dialog->label), TRUE);
+
hbox = gtk_hbox_new (FALSE, 6);
gtk_box_pack_start (GTK_BOX (hbox), dialog->image,
props->indicator_spacing = *indicator_spacing;
else
props->indicator_spacing = default_props.indicator_spacing;
+
+ g_free (indicator_size);
+ g_free (indicator_spacing);
}
static void
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-#include "gtksettings.h"
-
+#include "gtksettings.h"
+#include "gtkintl.h"
enum {
PROP_0,
- PROP_DOUBLE_CLICK_TIMEOUT,
- PROP_BELL_PITCH,
- PROP_BELL_DURATION,
- PROP_BELL_PERCENT
+ PROP_DOUBLE_CLICK_TIMEOUT
};
gtk_settings_class_init (GtkSettingsClass *class)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+ guint result;
parent_class = g_type_class_peek_parent (class);
quark_property_id = g_quark_try_string ("GObject-property-id");
g_assert (quark_property_id != 0); /* special quarks from GObjectClass */
- g_assert (PROP_DOUBLE_CLICK_TIMEOUT ==
- settings_install_property_parser (class,
- g_param_spec_int ("double-click-timeout", "Double Click Timeout", NULL,
- 0, G_MAXINT, 1000,
- G_PARAM_READWRITE),
- NULL));
- g_assert (PROP_BELL_PITCH ==
- settings_install_property_parser (class,
- g_param_spec_int ("bell-pitch", "Bell Pitch", NULL,
- 0, G_MAXINT, 440,
- G_PARAM_READWRITE),
- NULL));
- g_assert (PROP_BELL_DURATION ==
- settings_install_property_parser (class,
- g_param_spec_int ("bell_duration", "Bell Duration", NULL,
- 1, G_MAXINT, 250,
- G_PARAM_READWRITE),
- NULL));
- g_assert (PROP_BELL_PERCENT ==
- settings_install_property_parser (class,
- g_param_spec_float ("bell_percent", "Bell Percent", NULL,
- 0, 100, 80,
- G_PARAM_READWRITE),
- NULL));
+ result = settings_install_property_parser (class,
+ g_param_spec_int ("gtk-double-click-timeout",
+ _("Double Click Timeout"),
+ _("Maximum time allowed between two clicks for them to be considered a double click"),
+ 0, G_MAXINT, 1000,
+ G_PARAM_READWRITE),
+ NULL);
+ g_assert (result == PROP_DOUBLE_CLICK_TIMEOUT);
}
static void
g_object_get (object, pspec->name, &double_click_time, NULL);
gdk_set_double_click_time (double_click_time);
break;
- case PROP_BELL_PITCH:
- g_print ("settings-notify: %s = \"%s\"\n", pspec->name, contents);
- break;
- case PROP_BELL_DURATION:
- g_print ("settings-notify: %s = \"%s\"\n", pspec->name, contents);
- break;
- case PROP_BELL_PERCENT:
- g_print ("settings-notify: %s = \"%s\"\n", pspec->name, contents);
- break;
}
g_free (contents);
#include "gtkstock.h"
#include "gtkiconfactory.h"
#include "gtkimage.h"
+#include "gtkintl.h"
#define DEFAULT_SPACE_SIZE 5
GtkRequisition *requisition);
static void gtk_toolbar_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
+static void gtk_toolbar_style_set (GtkWidget *widget,
+ GtkStyle *prev_style);
static void gtk_toolbar_add (GtkContainer *container,
GtkWidget *widget);
static void gtk_toolbar_remove (GtkContainer *container,
gint position,
gboolean has_mnemonic);
+static void gtk_toolbar_update_button_relief (GtkToolbar *toolbar);
+
+static GtkReliefStyle get_button_relief (GtkToolbar *toolbar);
+static gint get_space_size (GtkToolbar *toolbar);
+static GtkToolbarSpaceStyle get_space_style (GtkToolbar *toolbar);
+
+
static GtkContainerClass *parent_class;
static guint toolbar_signals[LAST_SIGNAL] = { 0 };
widget_class->expose_event = gtk_toolbar_expose;
widget_class->size_request = gtk_toolbar_size_request;
widget_class->size_allocate = gtk_toolbar_size_allocate;
-
+ widget_class->style_set = gtk_toolbar_style_set;
+
container_class->add = gtk_toolbar_add;
container_class->remove = gtk_toolbar_remove;
container_class->forall = gtk_toolbar_forall;
GTK_ARG_READWRITE, ARG_ORIENTATION);
gtk_object_add_arg_type ("GtkToolbar::toolbar_style", GTK_TYPE_TOOLBAR_STYLE,
GTK_ARG_READWRITE, ARG_TOOLBAR_STYLE);
- gtk_object_add_arg_type ("GtkToolbar::space_size", GTK_TYPE_UINT,
- GTK_ARG_READWRITE, ARG_SPACE_SIZE);
- gtk_object_add_arg_type ("GtkToolbar::space_style", GTK_TYPE_TOOLBAR_SPACE_STYLE,
- GTK_ARG_READWRITE, ARG_SPACE_STYLE);
- gtk_object_add_arg_type ("GtkToolbar::relief", GTK_TYPE_RELIEF_STYLE,
- GTK_ARG_READWRITE, ARG_RELIEF);
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_int ("space_size",
+ _("Spacer size"),
+ _("Size of spacers"),
+ 0,
+ G_MAXINT,
+ DEFAULT_SPACE_SIZE,
+ G_PARAM_READABLE));
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_enum ("space_style",
+ _("Space style"),
+ _("Whether spacers are vertical lines or just blank"),
+ GTK_TYPE_TOOLBAR_SPACE_STYLE,
+ DEFAULT_SPACE_STYLE,
+
+ G_PARAM_READABLE));
+
+ gtk_widget_class_install_style_property (widget_class,
+ g_param_spec_enum ("button_relief",
+ _("Button relief"),
+ _("Type of bevel around toolbar buttons"),
+ GTK_TYPE_RELIEF_STYLE,
+ GTK_RELIEF_NORMAL,
+ G_PARAM_READABLE));
}
static void
toolbar->children = NULL;
toolbar->orientation = GTK_ORIENTATION_HORIZONTAL;
toolbar->style = GTK_TOOLBAR_ICONS;
- toolbar->relief = GTK_RELIEF_NORMAL;
- toolbar->space_size = DEFAULT_SPACE_SIZE;
- toolbar->space_style = DEFAULT_SPACE_STYLE;
toolbar->icon_size = DEFAULT_ICON_SIZE;
toolbar->tooltips = gtk_tooltips_new ();
toolbar->button_maxw = 0;
case ARG_TOOLBAR_STYLE:
gtk_toolbar_set_style (toolbar, GTK_VALUE_ENUM (*arg));
break;
- case ARG_SPACE_SIZE:
- gtk_toolbar_set_space_size (toolbar, GTK_VALUE_UINT (*arg));
- break;
- case ARG_SPACE_STYLE:
- gtk_toolbar_set_space_style (toolbar, GTK_VALUE_ENUM (*arg));
- break;
- case ARG_RELIEF:
- gtk_toolbar_set_button_relief (toolbar, GTK_VALUE_ENUM (*arg));
- break;
}
}
case ARG_TOOLBAR_STYLE:
GTK_VALUE_ENUM (*arg) = toolbar->style;
break;
- case ARG_SPACE_SIZE:
- GTK_VALUE_UINT (*arg) = toolbar->space_size;
- break;
- case ARG_SPACE_STYLE:
- GTK_VALUE_ENUM (*arg) = toolbar->space_style;
- break;
- case ARG_RELIEF:
- GTK_VALUE_ENUM (*arg) = toolbar->relief;
- break;
default:
arg->type = GTK_TYPE_INVALID;
break;
{
GtkToolbar *toolbar;
GtkToolbarChildSpace *child_space;
-
+ gint space_size;
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (widget));
g_return_if_fail (child != NULL);
toolbar = GTK_TOOLBAR (widget);
child_space = (GtkToolbarChildSpace *) child;
-
+ space_size = get_space_size (toolbar);
+
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
gtk_paint_vline (widget->style, widget->window,
GTK_WIDGET_STATE (widget), area, widget,
child_space->alloc_y + toolbar->button_maxh *
SPACE_LINE_END / SPACE_LINE_DIVISION,
child_space->alloc_x +
- (toolbar->space_size -
+ (space_size -
widget->style->xthickness) / 2);
else
gtk_paint_hline (widget->style, widget->window,
child_space->alloc_x + toolbar->button_maxw *
SPACE_LINE_END / SPACE_LINE_DIVISION,
child_space->alloc_y +
- (toolbar->space_size -
+ (space_size -
widget->style->ythickness) / 2);
}
if (child->type == GTK_TOOLBAR_CHILD_SPACE)
{
- if (toolbar->space_style == GTK_TOOLBAR_SPACE_LINE)
+ if (get_space_style (toolbar) == GTK_TOOLBAR_SPACE_LINE)
gtk_toolbar_paint_space_line (widget, &event->area, child);
}
else
gint button_maxw, button_maxh;
gint widget_maxw, widget_maxh;
GtkRequisition child_requisition;
-
+ gint space_size;
+
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (widget));
g_return_if_fail (requisition != NULL);
widget_maxw = 0;
widget_maxh = 0;
+ space_size = get_space_size (toolbar);
+
for (children = toolbar->children; children; children = children->next)
{
child = children->data;
{
case GTK_TOOLBAR_CHILD_SPACE:
if (toolbar->orientation == GTK_ORIENTATION_HORIZONTAL)
- requisition->width += toolbar->space_size;
+ requisition->width += space_size;
else
- requisition->height += toolbar->space_size;
+ requisition->height += space_size;
break;
case GTK_TOOLBAR_CHILD_RADIOBUTTON:
case GTK_TOOLBAR_CHILD_TOGGLEBUTTON:
if (GTK_WIDGET_VISIBLE (child->widget))
- {
+ {
gtk_widget_size_request (child->widget, &child_requisition);
nbuttons++;
GtkAllocation alloc;
GtkRequisition child_requisition;
gint border_width;
+ gint space_size;
g_return_if_fail (widget != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (widget));
else
alloc.y = allocation->y + border_width;
+ space_size = get_space_size (toolbar);
+
for (children = toolbar->children; children; children = children->next)
{
child = children->data;
{
child_space->alloc_x = alloc.x;
child_space->alloc_y = allocation->y + (allocation->height - toolbar->button_maxh) / 2;
- alloc.x += toolbar->space_size;
+ alloc.x += space_size;
}
else
{
child_space->alloc_x = allocation->x + (allocation->width - toolbar->button_maxw) / 2;
child_space->alloc_y = alloc.y;
- alloc.y += toolbar->space_size;
+ alloc.y += space_size;
}
break;
}
}
+static void
+gtk_toolbar_style_set (GtkWidget *widget,
+ GtkStyle *prev_style)
+{
+ if (prev_style)
+ gtk_toolbar_update_button_relief (GTK_TOOLBAR (widget));
+}
+
static void
gtk_toolbar_add (GtkContainer *container,
GtkWidget *widget)
if (type == GTK_TOOLBAR_CHILD_BUTTON)
{
child->widget = gtk_button_new ();
- gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief);
+ gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar));
}
else if (type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
{
child->widget = gtk_toggle_button_new ();
- gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief);
+ gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar));
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget),
FALSE);
}
child->widget = gtk_radio_button_new (widget
? gtk_radio_button_group (GTK_RADIO_BUTTON (widget))
: NULL);
- gtk_button_set_relief (GTK_BUTTON (child->widget), toolbar->relief);
+ gtk_button_set_relief (GTK_BUTTON (child->widget), get_button_relief (toolbar));
gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (child->widget), FALSE);
}
gtk_signal_emit (GTK_OBJECT (toolbar), toolbar_signals[STYLE_CHANGED], style);
}
-void
-gtk_toolbar_set_space_size (GtkToolbar *toolbar,
- gint space_size)
-{
- g_return_if_fail (toolbar != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
-
- if (toolbar->space_size != space_size)
- {
- toolbar->space_size = space_size;
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
- }
-}
-
-void
-gtk_toolbar_set_space_style (GtkToolbar *toolbar,
- GtkToolbarSpaceStyle space_style)
-{
- g_return_if_fail (toolbar != NULL);
- g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
-
- if (toolbar->space_style != space_style)
- {
- toolbar->space_style = space_style;
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
- }
-}
-
void
gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
gboolean enable)
gtk_tooltips_disable (toolbar->tooltips);
}
-void
-gtk_toolbar_set_button_relief (GtkToolbar *toolbar,
- GtkReliefStyle relief)
+static void
+gtk_toolbar_update_button_relief (GtkToolbar *toolbar)
{
GList *children;
GtkToolbarChild *child;
+ GtkReliefStyle relief;
g_return_if_fail (toolbar != NULL);
g_return_if_fail (GTK_IS_TOOLBAR (toolbar));
- if (toolbar->relief != relief)
+ relief = get_button_relief (toolbar);
+
+ for (children = toolbar->children; children; children = children->next)
{
- toolbar->relief = relief;
-
- for (children = toolbar->children; children; children = children->next)
- {
- child = children->data;
- if (child->type == GTK_TOOLBAR_CHILD_BUTTON ||
- child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON ||
- child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
- gtk_button_set_relief (GTK_BUTTON (child->widget), relief);
- }
-
- gtk_widget_queue_resize (GTK_WIDGET (toolbar));
+ child = children->data;
+ if (child->type == GTK_TOOLBAR_CHILD_BUTTON ||
+ child->type == GTK_TOOLBAR_CHILD_RADIOBUTTON ||
+ child->type == GTK_TOOLBAR_CHILD_TOGGLEBUTTON)
+ gtk_button_set_relief (GTK_BUTTON (child->widget), relief);
}
}
-GtkReliefStyle
-gtk_toolbar_get_button_relief (GtkToolbar *toolbar)
-{
- g_return_val_if_fail (toolbar != NULL, GTK_RELIEF_NORMAL);
- g_return_val_if_fail (GTK_IS_TOOLBAR (toolbar), GTK_RELIEF_NORMAL);
-
- return toolbar->relief;
-}
-
static void
gtk_real_toolbar_orientation_changed (GtkToolbar *toolbar,
GtkOrientation orientation)
gtk_widget_queue_resize (GTK_WIDGET (toolbar));
}
}
+
+
+static GtkReliefStyle
+get_button_relief (GtkToolbar *toolbar)
+{
+ GtkReliefStyle button_relief = GTK_RELIEF_NORMAL;
+
+ gtk_widget_style_get (GTK_WIDGET (toolbar),
+ "button_relief", &button_relief,
+ NULL);
+
+ return button_relief;
+}
+
+static gint
+get_space_size (GtkToolbar *toolbar)
+{
+ gint space_size = DEFAULT_SPACE_SIZE;
+
+ gtk_widget_style_get (GTK_WIDGET (toolbar),
+ "space_size", &space_size,
+ NULL);
+
+ return space_size;
+}
+
+static GtkToolbarSpaceStyle
+get_space_style (GtkToolbar *toolbar)
+{
+ GtkToolbarSpaceStyle space_style = DEFAULT_SPACE_STYLE;
+
+ gtk_widget_style_get (GTK_WIDGET (toolbar),
+ "space_style", &space_style,
+ NULL);
+
+
+ return space_style;
+}
GList *children;
GtkOrientation orientation;
GtkToolbarStyle style;
- gint space_size; /* big optional space between buttons */
- GtkToolbarSpaceStyle space_style;
GtkIconSize icon_size;
GtkTooltips *tooltips;
gint button_maxw;
gint button_maxh;
- GtkReliefStyle relief;
};
struct _GtkToolbarClass
GtkOrientation orientation);
void gtk_toolbar_set_style (GtkToolbar *toolbar,
GtkToolbarStyle style);
-void gtk_toolbar_set_space_size (GtkToolbar *toolbar,
- gint space_size);
-void gtk_toolbar_set_space_style (GtkToolbar *toolbar,
- GtkToolbarSpaceStyle space_style);
void gtk_toolbar_set_tooltips (GtkToolbar *toolbar,
gboolean enable);
-void gtk_toolbar_set_button_relief (GtkToolbar *toolbar,
- GtkReliefStyle relief);
-GtkReliefStyle gtk_toolbar_get_button_relief (GtkToolbar *toolbar);
-
#ifdef __cplusplus
}
gtk_toolbar_set_style (GTK_TOOLBAR (data), GTK_TOOLBAR_BOTH_HORIZ);
}
-static void
-set_toolbar_small_space (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 5);
-}
-
-static void
-set_toolbar_big_space (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_space_size (GTK_TOOLBAR (data), 10);
-}
-
static void
set_toolbar_enable (GtkWidget *widget,
gpointer data)
gtk_toolbar_set_tooltips (GTK_TOOLBAR (data), FALSE);
}
-static void
-set_toolbar_borders (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_button_relief (GTK_TOOLBAR (data), GTK_RELIEF_NORMAL);
-}
-
-static void
-set_toolbar_borderless (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_button_relief (GTK_TOOLBAR (data), GTK_RELIEF_NONE);
-}
-
-static void
-set_toolbar_space_style_empty (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_space_style (GTK_TOOLBAR (data), GTK_TOOLBAR_SPACE_EMPTY);
-}
-
-static void
-set_toolbar_space_style_line (GtkWidget *widget,
- gpointer data)
-{
- gtk_toolbar_set_space_style (GTK_TOOLBAR (data), GTK_TOOLBAR_SPACE_LINE);
-}
-
static void
create_toolbar (void)
{
gtk_widget_realize (window);
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
- gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE);
gtk_toolbar_insert_stock (GTK_TOOLBAR (toolbar),
GTK_STOCK_NEW,
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Small", "Use small spaces", "Toolbar/Small",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_small_space, toolbar);
- gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Big", "Use big spaces", "Toolbar/Big",
- new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_big_space, toolbar);
-
- gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
"Enable", "Enable tooltips", NULL,
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Borders", "Show Borders", NULL,
+ "Frobate", "Frobate tooltip", NULL,
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_borders, toolbar);
+ (GtkSignalFunc) NULL, toolbar);
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Borderless", "Hide Borders", NULL,
+ "Baz", "Baz tooltip", NULL,
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_borderless, toolbar);
+ (GtkSignalFunc) NULL, toolbar);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Empty", "Empty spaces", NULL,
+ "Blah", "Blah tooltip", NULL,
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_space_style_empty, toolbar);
+ (GtkSignalFunc) NULL, toolbar);
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Lines", "Lines in spaces", NULL,
+ "Bar", "Bar tooltip", NULL,
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_space_style_line, toolbar);
+ (GtkSignalFunc) NULL, toolbar);
gtk_container_add (GTK_CONTAINER (window), toolbar);
}
gtk_widget_realize (window);
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_BOTH);
- gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NONE);
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
"Horizontal", "Horizontal toolbar layout", NULL,
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Small", "Use small spaces", NULL,
+ "Woot", "Woot woot woot", NULL,
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_small_space, toolbar);
+ (GtkSignalFunc) NULL, toolbar);
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Big", "Use big spaces", "Toolbar/Big",
+ "Blah", "Blah blah blah", "Toolbar/Big",
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_big_space, toolbar);
+ (GtkSignalFunc) NULL, toolbar);
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_append_space (GTK_TOOLBAR (toolbar));
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Borders", "Show Borders", NULL,
+ "Hoo", "Hoo tooltip", NULL,
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_borders, toolbar);
+ (GtkSignalFunc) NULL, toolbar);
gtk_toolbar_append_item (GTK_TOOLBAR (toolbar),
- "Borderless", "Hide Borders", NULL,
+ "Woo", "Woo tooltip", NULL,
new_pixmap ("test.xpm", window->window, &window->style->bg[GTK_STATE_NORMAL]),
- (GtkSignalFunc) set_toolbar_borderless, toolbar);
+ (GtkSignalFunc) NULL, toolbar);
return toolbar;
}
gtk_widget_show (handle_box);
toolbar = make_toolbar (window);
- gtk_toolbar_set_button_relief (GTK_TOOLBAR (toolbar), GTK_RELIEF_NORMAL);
+
gtk_container_add (GTK_CONTAINER (handle_box), toolbar);
gtk_widget_show (toolbar);
cb = gtk_combo_new ();
gtk_combo_set_popdown_strings (GTK_COMBO (cb), cbitems);
- gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(cb)->entry), "hello world");
+ gtk_entry_set_text (GTK_ENTRY (GTK_COMBO(cb)->entry), "hello world \n\n\n foo");
gtk_editable_select_region (GTK_EDITABLE (GTK_COMBO(cb)->entry),
0, -1);
gtk_box_pack_start (GTK_BOX (box2), cb, TRUE, TRUE, 0);
# xthickness = 20
GtkSpinButton::shadow_type = etched-out
GtkEntry::cursor_color = "#ff0000"
+ GtkToolbar::space_size = 10
+ GtkToolbar::space_style = line
+ GtkToolbar::button_relief = none
+ GtkButtonBox::child_min_width = 0
+ GtkButtonBox::child_min_height = 0
}
class "GtkWidget" style "global-style-properties"
{
GtkTextIter iter, iter2;
GtkTextTag *tag;
+ GtkTextChildAnchor *anchor;
GdkColor color;
GdkColor color2;
GdkPixbuf *pixbuf;
NULL);
-#if 0
gtk_text_buffer_get_iter_at_offset (buffer, &iter, 0);
anchor = gtk_text_buffer_create_child_anchor (buffer, &iter);
g_object_set_data_full (G_OBJECT (buffer), "anchor", anchor,
(GDestroyNotify) g_object_unref);
-#endif
pixbuf = gdk_pixbuf_new_from_xpm_data (book_closed_xpm);
GtkTextChildAnchor *anchor;
Buffer *buffer;
- return;
-
buffer = view->buffer;
+
+ /* REMOVE to test widgets */
+ return;
anchor = g_object_get_data (G_OBJECT (buffer->buffer),
"anchor");
if (anchor && !gtk_text_child_anchor_get_deleted (anchor))
{
GtkWidget *widget;
-
- widget = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
- GTK_ICON_SIZE_DIALOG);
widget = gtk_button_new_with_label ("Foo");